<?php
declare (strict_types = 1);

namespace app\model;

use think\db\exception\DbException;
use think\Model;

/**
 * @mixin \think\Model
 */
class Login extends Model
{
    protected $table = 'user';
    //检查账号密码是否正确
    public function checkLogin($param)
    {
        //判断是否填写账号信息
        if (!$param['user']||!$param['pwd']) return false;
        try {
            return $this->where(['name' => $param['user'], 'pwd' => $param['pwd']])->count()==1?true:false;
        } catch (DbException $e) {
            return $e->getMessage();
        }
    }
}
